﻿using System;
using System.Collections.Generic;
using ZilLion.Service.Core.DapperWrapper;
using ZilLion.Service.WeChatMall.Domain.Entitys.Orders;

namespace ZilLion.Service.WeChatMall.Domain.Repositorys.Interface.Order
{
    public interface IOrderMainRepository
    {
        #region 保存

        /// <summary>
        ///     新增
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="unit"></param>
        void AddMainInfo(OrderMainInfoEntity entity, UnitOfWork unit = null);

        /// <summary>
        ///     修改
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="unit"></param>
        void ModifyMainInfo(OrderMainInfoEntity entity, UnitOfWork unit = null);

        #endregion

        #region 查询

        /// <summary>
        ///     根据sno 获取order主表信息
        /// </summary>
        /// <param name="sno"></param>
        /// <returns></returns>
        OrderMainInfoEntity GetOrderMainBySno(string sno);

        /// <summary>
        ///     查询所有单据主表信息
        /// </summary>
        /// <returns></returns>
        IList<OrderMainInfoEntity> GetOrders(long custid);

        /// <summary>
        ///     分页查找(按照单据号倒序排)
        /// </summary>
        /// <param name="custid"></param>
        /// <param name="pageCount">每一页大小</param>
        /// <param name="minsno">当前已查最大sno</param>
        /// <returns></returns>
        IList<OrderMainInfoEntity> GetOrdersByPage(long custid, int pageCount, string minsno);

        /// <summary>
        ///     按时间获取单据主表信息
        /// </summary>
        /// <param name="custid"></param>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        IList<OrderMainInfoEntity> GetOrdersByBilldate(long custid, DateTime beginDate, DateTime endDate);

        #endregion
    }
}